#region Encoding
	function Convert-Rot13String
	{
		<#
			.NOTES
				Author: Will Steele
				
			.LINK
				http://learningpcs.blogspot.com/2012/06/powershell-v2-function-convertfrom.html
		#>
		
		[CmdletBinding()]
		param(
			[Parameter(
				Mandatory = $true,
				ValueFromPipeline = $true
			)]
			[String]
			$inputString
		)
		
		[String] $string = $null;
		$inputString.ToCharArray() |
		ForEach-Object {
			Write-Verbose "$($_): $([int] $_)"
			if((([int] $_ -ge 97) -and ([int] $_ -le 109)) -or (([int] $_ -ge 65) -and ([int] $_ -le 77)))
			{
				$string += [char] ([int] $_ + 13);
			}
			elseif((([int] $_ -ge 110) -and ([int] $_ -le 122)) -or (([int] $_ -ge 78) -and ([int] $_ -le 90)))
			{
				$string += [char] ([int] $_ - 13);
			}
			else
			{
				$string += $_
			}
		}
		$string
	} # end function Convert-Rot13String
#endregion Encoding

#region CryptoFunctions
	function Measure-DoubleLetterFrequency
	{
		<#
			.SYNOPSIS
				Measures Double Letter Frequency
			.DESCRIPTION
				This function measures the doule letter frequency in a crypto string.
			.PARAMETER  cipherText
				The cipher text to measure double letter frequency. 
			.EXAMPLE
				PS C:\> Measure-DoubleLetterFrequency -cipherText "AAAABBBBBVVVV"
			.INPUTS
				System.String
			.OUTPUTS
				System.String
			.NOTES
				Original Author: Lee Holmes
			.LINK
				http://www.leeholmes.com/blog/2009/10/19/powershell-cryptography-library/
			.LINK
				poshsec.codeplex.com
		#>
		
		param(
			[Parameter(Mandatory=$true)]
			[string]$cipherText
		)
		
	    $frequentDoubles = "ss","ee","tt","ff","ll","mm","oo" 
	        
	    "`nDouble Frequencies:`n" 
	    $groups = [Regex]::Matches($cipherText, '(.)\1') | % { $_.Value } | 
	        group | Sort -Desc Count

	    $groupNumber = 0 
	    $(foreach($group in $groups) 
	    { 
	        $group | Select Name, 
	            @{ 
	                Name = "Replacement"; 
	                Expression = { $frequentDoubles[$groupNumber] } }, 
	            Count 
	        $groupNumber++   
	    }) | ft -auto | out-string | % { $_.Trim() } 
	    
	    "`nOther groups:" 
	    "$($frequentDoubles[$groupNumber..($frequentDoubles.Length - 1)])" 
	} # end function Measure-DoubleLetterFrequency
	
#endregion CryptoFunctions

#region ModuleExports
	#region EncodingExports
		Export-ModuleMember -Function "Convert-Rot13String"
	#endregion EncodingExports
	#region CryptoExports
		Export-ModuleMember -Function "Measure-DoubleLetterFrequency"
	#endregion CryptoExports
#endregion ModuleExports